package 输入方案;

import java.util.Scanner;

/**
 * @author zc
 * @version 1.0
 * @date 2021/8/31 15:15
 *
 * nextLine()的示例代码如下
 */
public class Demo02 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入字符串");
        String temp = scanner.nextLine();  //读到回车为止，即读一行
        System.out.println("您输入字符串为"+temp);
        String[] res = temp.split(" ");
        System.out.println("转换为数组是");
        for (int i = 0; i < res.length; i++) {
            System.out.println("key="+i+": value = "+res[i]);
        }
    }
}
